<style>
    body {
        background-color: #f9f9f9;
    }
    .listTd td {
        text-align: center;
        border: 1px solid #ddd;
    }
    .modifyStatus {
        cursor:pointer;
    }
</style>
<script>
</script>
<form id="apply_Plan_form" method="post">
    <table id="applyPlanList" class="table table-hover">
        {% if (type == 3 and existBookId == 1) or (type == 4 and existBookId == 1) %}
            <tr>
                <td colspan="7">
                    查询书：<select style="width: 250px" id="bookIdArr" class="form-control"></select>
                    书Id：<input id="selectBookId" style="width: 230px;" autocomplete="off">
                    {% if type == 4 %}
                    <span id="showNotice" style="color: red;font-size: smaller;">请输入书名在查询框中查询书id，否则无法添加排期</span>
                    {% endif %}
                </td>
            </tr>
        {% endif %}
        <tr class="info listTitle" >
            <th rowspan="2" style="text-align: center;width: 300px;border: 1px solid #ddd">教学进度</th>
            <th rowspan="2" style="text-align: center;width: 360px;border: 1px solid #ddd">录入需求</th>
            <th colspan="2" style="text-align: center;width: 230px;border: 1px solid #ddd">申请时间</th>
            <th colspan="2" style="text-align: center;width: 230px;border: 1px solid #ddd;background-color: #C95A08;color: white">计划时间</th>
            <th rowspan="2" style="text-align: center;width: 200px;border: 1px solid #ddd">状态</th>
        </tr>
        <tr class="info listTitle" >
            <th style="text-align: center;width: 115px;border: 1px solid #ddd">开始</th>
            <th style="text-align: center;width: 115px;border: 1px solid #ddd">完成</th>
            <th style="text-align: center;width: 115px;border: 1px solid #ddd;background-color: #C95A08;color: white">开始</th>
            <th style="text-align: center;width: 115px;border: 1px solid #ddd;background-color: #C95A08;color: white">完成</th>
        </tr>
        {% if data is not empty and (type == 1 or type == 2 or (type == 3 and existBookId == 2) or (type == 4 and existBookId == 2)) %}
            {% for item in data %}
                <tr class="listTd" title="【创建】{{ item['iCreateUserId'] }} {{  item['tCreateDate'] }} 【最后修改】{{ item['iLastModifyUserId'] }} {{  item['tLastModifyDate'] }}" {% if item['iStatus'] == 4 %} style="background-color: #D9D9D9" {% else %} {% endif %}>
                    <td style="display: none"><input name="handle[{{ item['iId'] }}][id]" value="{{ item['iId'] }}"></td>
                    <td style="text-align: left">{{ item['sProgress'] }}</td>
                    <td style="text-align: left">{{ item['sDemand'] }}</td>
                    <td >{{ item['sStartDate'] }}</td>
                    <td >{{ item['sEndDate'] }}</td>
                    {% if item['sRealStartDate'] is not empty %}
                        <td style="color: #C95A08">{{ item['sRealStartDate'] }}</td>
                    {% else %}
                        <td ><input style="width: 95px;" class="form-date form-control" type="text" name="handle[{{ item['iId'] }}][realStartDate]" must="true" autocomplete="off"></td>
                    {% endif %}
                    {% if item['sRealEndDate'] is not empty %}
                        <td style="color: #C95A08">{{ item['sRealEndDate'] }}</td>
                    {% else %}
                        <td ><input style="width: 95px;" class="form-date form-control" type="text" name="handle[{{ item['iId'] }}][realEndDate]" must="true" autocomplete="off"></td>
                    {% endif %}
                    <td >
                        {% if item['iStatus'] == 0 %}
                            {% if item['sRealEndDate'] is empty AND (item['isCreateMan'] == 1 OR power['del'] == true) %}
                                <a style="color: red" class="modifyStatus btn btn-default btn-sm" id="checkDel_{{ item['iId'] }}">取消</a>
                            {% endif %}
                            {% if power['check'] == true and item['sRealEndDate'] is not empty and item['isCreateMan'] == 1 %}
                                <a style="color: green" class="modifyStatus btn btn-default btn-sm" id="checkTrue_{{ item['iId'] }}">同意</a>
                                <a style="color: blue" class="modifyStatus btn btn-default btn-sm" id="checkFalse_{{ item['iId'] }}">不同意</a>
                            {% endif %}
                        {% else %}
                            {{ item['iStatusStr'] }}
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
        {% endif %}
        <tr class="listCopyTd" style="display: none">
            {#<td style="display: none"><input name="addPlanList[0][id]" value="{{ id }}"></td>#}
            <td ><textarea style="height: 50px;width: 200px;border: 1px solid #ddd" name="addPlanList[0][progress]" class="form-control"></textarea></td>
            <td >
                <select style="width: 150px;border: 1px solid #ddd" name="addPlanList[0][demand][]" class="form-control">
                    {% if !((type == 3 and existBookId == 1) or (type == 4 and existBookId == 1)) %}
                        {% for id,text in catalogs %}
                            <option value="{{ id }}">{{ text }}</option>
                        {% endfor %}
                    {% endif %}
                </select>
                <a id="addPlanCateLogs_0" class="btn btn-sm btn-success pull-right btn-default">选择章节</a>
            </td>
            {#<td ><input style="width: 95px;border: 1px solid #ddd" class="form-date form-control" type="text" name="addPlanList[0][startDate]" autocomplete="off" ></td>#}
            {#<td ><input style="width: 95px;border: 1px solid #ddd" class="form-date form-control" type="text" name="addPlanList[0][endDate]" autocomplete="off" ></td>#}
            <td></td>
            <td></td>
            <td ><input style="width: 95px;border: 1px solid #ddd" class="form-date form-control" type="text" name="addPlanList[0][realStartDate]" must="true" autocomplete="off" placeholder="必填"></td>
            <td ><input style="width: 95px;border: 1px solid #ddd" class="form-date form-control" type="text" name="addPlanList[0][realEndDate]" must="true" autocomplete="off" placeholder="必填"></td>
        </tr>
        {% if power['add'] == true %}
            <tr>
                <td colspan="7"><a id="addApplyPlan" class="btn btn-sm btn-success pull-left" style="margin-right: 20px;">+ 新增排期</a></td>
            </tr>
        {% endif %}
    </table>
</form>